﻿using System;
using System.Collections.Generic;
using System.Text;
using IService.Data.IManager;
using System.Data;
using IService.DataDLL;
using IService.Model;

namespace IService.Data.OlbImpl.ManagerImpl
{
    public class ActivityApplyDaManager : IActivityApplyDaManager
    {
        public DataTable GetActivityApplyListAll(Type infoType)
        {
            return DataAccess.SelectAll(infoType);
        }

        public DataTable GetActivityApplyListPagin(Type infoType, PagingEntity pe)
        {
            return DataAccess.SelectPaging(infoType, pe);
        }

        public DataTable GetLatestActivityApplyList(Type infoType, int activityApplynum)
        {
            string WhereClause = "";
            string Order = "CreateTime desc";
            return DataAccess.SelectTop(infoType, activityApplynum, WhereClause, Order);
        }

        public ActivityApply GetActivityApplyById(ActivityApply activityApply)
        {
            activityApply.Select();
            return activityApply;
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="ActivityApply"></param>
        /// <returns></returns>
        public bool InsertActivityApply(ActivityApply activityApply)
        {
            return DataAccess.Insert(activityApply);
        }

        public bool UpdateActivityApply(ActivityApply activityApply)
        {
            return DataAccess.Update(activityApply);
        }

        public bool DeleteActivityApply(ActivityApply activityApply)
        {
            return DataAccess.Delete(activityApply);
        }

        public bool DeleteActivityApplyByIds(Type infoType, string Ids)
        {
            string WhereClause = "Id in(" + Ids + ")";
            return DataAccess.Delete(infoType, WhereClause);
        }

        public bool DeleteActivityApplyByActivityID(Type infoType, int Id)
        {
            string WhereClause = "ActivityID =" + Id;
            return DataAccess.Delete(infoType, WhereClause);
        }

        public bool DeleteActivityApplyByActivityIds(Type infoType, string Ids)
        {
            string WhereClause = "ActivityID in(" + Ids + ")";
            return DataAccess.Delete(infoType, WhereClause);
        }
    }
}
